<style lang="scss">
.component-preview {
  padding-right: 10px;
  &:last-of-type {
    padding-bottom: 20px;
  }
  h4 {
    font-size: 20px;
    margin: 40px 0 20px;
    color: #909399
  }
  .demo-item {
    margin-top: 10px;
    margin-right: 40px;
  }

  .demo-line {
    margin: 15px 0;
  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n + 1) {
    background-color: #d3dce6;
  }

  .el-avatar:not(:last-child) {
    margin-right: 20px;
  }

  .avatar-demo {
    display: flex;
    align-items: center;
  }
}
</style>
<template>
  <div class="component-preview">
    <h4>Button</h4>
    <m-row class="demo-line">
      <m-button>Default</m-button>
      <m-button type="primary">Primary</m-button>
      <m-button type="success">Success</m-button>
      <m-button type="info">Info</m-button>
      <m-button type="warning">Warning</m-button>
      <m-button type="danger">Danger</m-button>
    </m-row>
    <m-row class="demo-line">
      <m-button plain>Plain</m-button>
      <m-button type="primary" plain>Primary</m-button>
      <m-button type="success" plain>Success</m-button>
      <m-button type="info" plain>Info</m-button>
      <m-button type="warning" plain>Warning</m-button>
      <m-button type="danger" plain>Danger</m-button>
    </m-row>
    <m-row class="demo-line">
      <m-button round>Round</m-button>
      <m-button type="primary" round>Primary</m-button>
      <m-button type="success" round>Success</m-button>
      <m-button type="info" round>Info</m-button>
      <m-button type="warning" round>Warning</m-button>
      <m-button type="danger" round>Danger</m-button>
    </m-row>
    <m-row class="demo-line">
      <m-button icon="el-icon-search" circle></m-button>
      <m-button type="primary" icon="el-icon-edit" circle></m-button>
      <m-button type="success" icon="el-icon-check" circle></m-button>
      <m-button type="info" icon="el-icon-message" circle></m-button>
      <m-button type="warning" icon="el-icon-star-off" circle></m-button>
      <m-button type="danger" icon="el-icon-delete" circle></m-button>
    </m-row>
    <m-row class="demo-line">
      <m-button>Default</m-button>
      <m-button size="medium">Medium</m-button>
      <m-button size="small">Small</m-button>
      <m-button size="mini">Mini</m-button>
    </m-row>
    <h4>Radio</h4>
    <m-row class="demo-line">
      <m-radio v-model="radio" label="1">Option A</m-radio>
      <m-radio v-model="radio" label="2">Option B</m-radio>
    </m-row>
    <m-row class="demo-line">
      <m-radio-group v-model="radio1">
        <m-radio-button label="New York"></m-radio-button>
        <m-radio-button label="Washington"></m-radio-button>
        <m-radio-button label="Los Angeles"></m-radio-button>
        <m-radio-button label="Chicago"></m-radio-button>
      </m-radio-group>
    </m-row>
    <m-row class="demo-line">
      <m-radio v-model="radio2" label="1" border>Option A</m-radio>
      <m-radio v-model="radio2" label="2" border>Option B</m-radio>
    </m-row>
    <h4>Checkbox</h4>
    <m-row class="demo-line">
      <m-checkbox v-model="checked">Option</m-checkbox>
    </m-row>
    <m-row class="demo-line">
      <m-checkbox-group v-model="checked1">
        <m-checkbox-button v-for="city in ['Shanghai', 'Beijing', 'Guangzhou', 'Shenzhen']" :label="city" :key="city">{{city}}</m-checkbox-button>
      </m-checkbox-group>
    </m-row>
    <m-row class="demo-line">
      <m-checkbox v-model="checked2" label="Option1" border></m-checkbox>
    </m-row>
    <h4>Input</h4>
    <m-row style="width: 180px">
      <m-input placeholder="Please input" v-model="input"></m-input>
    </m-row>
    <h4>InputNumber</h4>
    <m-row>
      <m-input-number v-model="inputNumber" :min="1" :max="10"></m-input-number>
    </m-row>
    <h4>Select</h4>
    <m-row>
      <m-select v-model="selectValue" placeholder="Select">
        <m-option
          v-for="item in selectOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></m-option>
      </m-select>
    </m-row>
    <h4>Cascader</h4>
    <m-row>
      <m-cascader :options="cascadeOptions" v-model="cascaderValue"></m-cascader>
    </m-row>
    <h4>Switch</h4>
    <m-row>
      <m-switch v-model="switchValue"></m-switch>
      <m-switch
        style="margin-left: 40px"
        v-model="switchValue"
        active-text="Pay by month"
        inactive-text="Pay by year">
      </m-switch>
    </m-row>
    <h4>Slider</h4>
    <m-row style="width: 380px">
      <m-slider v-model="slider"></m-slider>
    </m-row>
    <h4>DatePicker</h4>
    <m-row>
      <m-date-picker v-model="datePicker" type="date"></m-date-picker>
    </m-row>
    <h4>Rate</h4>
    <m-row>
      <m-rate class="demo-line" v-model="rate"></m-rate>
      <m-rate
        class="demo-line"
        v-model="rate"
        show-score
        text-color="#ff9900"
        score-template="{value} points">
      </m-rate>
    </m-row>
    <h4>Transfer</h4>
    <m-row>
      <m-transfer v-model="transfer" filterable :data="transferData">
        <m-button class="transfer-footer" slot="left-footer" size="small">Operation</m-button>
        <m-button class="transfer-footer" slot="right-footer" size="small">Operation</m-button>
      </m-transfer>
    </m-row>
    <h4>Table</h4>
    <m-row>
      <m-table :data="tableData" style="width: 70%">
        <m-table-column prop="date" label="Date" width="180"></m-table-column>
        <m-table-column prop="name" label="Name" width="180"></m-table-column>
        <m-table-column prop="address" label="Address"></m-table-column>
      </m-table>
    </m-row>
    <h4>Tag</h4>
    <m-row>
      <m-tag class="demo-item" closable>Tag One</m-tag>
      <m-tag class="demo-item" closable type="success">Tag Two</m-tag>
      <m-tag class="demo-item" closable type="info">Tag Three</m-tag>
      <m-tag class="demo-item" closable type="warning">Tag Four</m-tag>
      <m-tag class="demo-item" closable type="danger">Tag Five</m-tag>
    </m-row>
    <h4>Progress</h4>
    <m-row style="width: 380px">
      <m-progress :percentage="20"></m-progress>
      <m-progress :percentage="60" status="exception"></m-progress>
      <m-progress :percentage="100" status="success"></m-progress>
    </m-row>
    <h4>Tree</h4>
    <m-row style="width: 380px">
      <m-tree :data="treeData" :props="defaultTreeProps" ></m-tree>
    </m-row>
    <h4>Pagination</h4>
    <m-row>
      <m-pagination layout="prev, pager, next" :total="1000"></m-pagination>
    </m-row>
    <h4>Badge</h4>
    <m-row>
      <m-badge :value="12" class="demo-item">
        <m-button size="small">comments</m-button>
      </m-badge>
      <m-badge :value="3" class="demo-item">
        <m-button size="small">replies</m-button>
      </m-badge>
      <m-badge :value="1" class="demo-item" type="primary">
        <m-button size="small">comments</m-button>
      </m-badge>
      <m-badge :value="2" class="demo-item" type="warning">
        <m-button size="small">replies</m-button>
      </m-badge>
    </m-row>
    <h4>Alert</h4>
    <m-row style="width: 380px;">
      <m-alert class="demo-item" title="success alert" type="success" show-icon></m-alert>
      <m-alert class="demo-item" title="info alert" type="info" close-text="Gotcha" show-icon></m-alert>
      <m-alert class="demo-item" title="warning alert" type="warning" show-icon></m-alert>
      <m-alert
        class="demo-item"
        title="error alert"
        type="error"
        description="more text description"
        show-icon>
      </m-alert>
    </m-row>
    <h4>Loading</h4>
    <m-row>
      <m-table :data="tableData" style="width: 90%" v-loading="true">
        <m-table-column prop="date" label="Date" width="180"></m-table-column>
        <m-table-column prop="name" label="Name" width="180"></m-table-column>
        <m-table-column prop="address" label="Address"></m-table-column>
      </m-table>
    </m-row>
    <h4>Message</h4>
    <m-row>
      <div role="alert" class="demo-item el-message el-message--success el-message-fade-leave-active el-message-fade-leave-to" style="top: 0;left: 0;width: 100px; opacity: 1; position: relative;transform: none;"><i class="el-message__icon el-icon-success"></i><p class="el-message__content">Congrats, this is a success message.</p><!----></div>
      <div role="alert" class="demo-item el-message el-message--warning el-message-fade-leave-active el-message-fade-leave-to" style="top: 0;left: 0;width: 100px; opacity: 1; position: relative;transform: none;"><i class="el-message__icon el-icon-warning"></i><p class="el-message__content">Warning, this is a warning message.</p><!----></div>
      <div role="alert" class="demo-item el-message el-message--info el-message-fade-leave-active el-message-fade-leave-to" style="top: 0;left: 0;width: 100px; opacity: 1; position: relative;transform: none;"><i class="el-message__icon el-icon-info"></i><p class="el-message__content">This is a message.</p><!----></div>
      <div role="alert" class="demo-item el-message el-message--error is-closable el-message-fade-leave-active el-message-fade-leave-to" style="top: 0;left: 0;width: 100px; opacity: 1; position: relative;transform: none;"><i class="el-message__icon el-icon-error"></i><p class="el-message__content">Oops, this is a error message.</p><i class="el-message__closeBtn el-icon-close"></i></div>
    </m-row>
    <h4>MessageBox</h4>
    <m-row>
      <div class="el-message-box"><div class="el-message-box__header"><div class="el-message-box__title"><!----><span>Warning</span></div><button type="button" aria-label="Close" class="el-message-box__headerbtn"><i class="el-message-box__close el-icon-close"></i></button></div><div class="el-message-box__content"><div class="el-message-box__status el-icon-warning"></div><div class="el-message-box__message"><p>This will permanently delete the file. Continue?</p></div><div class="el-message-box__input" style="display: none;"><div class="el-input"><!----><input type="text" autocomplete="off" placeholder="" class="el-input__inner"><!----><!----><!----></div><div class="el-message-box__errormsg" style="visibility: hidden;"></div></div></div><div class="el-message-box__btns"><button type="button" class="el-button el-button--default el-button--small"><!----><!----><span>
          Cancel
        </span></button><button type="button" class="el-button el-button--default el-button--small el-button--primary "><!----><!----><span>
          OK
        </span></button></div></div>
    </m-row>
    <h4>Notification</h4>
    <m-row>
      <div role="alert" class="el-notification right" style="position: relative; left: 0;"><!----><div class="el-notification__group"><span class="el-notification__title">Notification</span><div class="el-notification__content"><div>This is a message </div></div><div class="el-notification__closeBtn el-icon-close"></div></div></div>
    </m-row>
    <h4>Menu</h4>
    <m-row>
      <m-menu :default-active="menu" class="el-menu-demo" mode="horizontal">
        <m-menu-item index="1">Processing Center</m-menu-item>
        <m-submenu index="2">
          <template slot="title">Workspace</template>
          <m-menu-item index="2-1">item one</m-menu-item>
          <m-menu-item index="2-2">item two</m-menu-item>
          <m-menu-item index="2-3">item three</m-menu-item>
          <m-submenu index="2-4">
            <template slot="title">item four</template>
            <m-menu-item index="2-4-1">item one</m-menu-item>
            <m-menu-item index="2-4-2">item two</m-menu-item>
            <m-menu-item index="2-4-3">item three</m-menu-item>
          </m-submenu>
        </m-submenu>
        <m-menu-item index="3" disabled>Info</m-menu-item>
        <m-menu-item index="4">
          <a href="https://www.ele.me" target="_blank">Orders</a>
        </m-menu-item>
      </m-menu>
      <m-menu
        default-active="2"
        class="demo-line"
      >
        <m-submenu index="1">
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>Navigator One</span>
          </template>
          <m-menu-item-group title="Group One">
            <m-menu-item index="1-1">item one</m-menu-item>
            <m-menu-item index="1-2">item one</m-menu-item>
          </m-menu-item-group>
          <m-menu-item-group title="Group Two">
            <m-menu-item index="1-3">item three</m-menu-item>
          </m-menu-item-group>
          <m-submenu index="1-4">
            <template slot="title">item four</template>
            <m-menu-item index="1-4-1">item one</m-menu-item>
          </m-submenu>
        </m-submenu>
        <m-menu-item index="2">
          <i class="el-icon-menu"></i>
          <span>Navigator Two</span>
        </m-menu-item>
        <m-menu-item index="3" disabled>
          <i class="el-icon-document"></i>
          <span>Navigator Three</span>
        </m-menu-item>
        <m-menu-item index="4">
          <i class="el-icon-setting"></i>
          <span>Navigator Four</span>
        </m-menu-item>
      </m-menu>
    </m-row>
    <h4>Tabs</h4>
    <m-row>
      <m-tabs v-model="tab" class="demo-item">
        <m-tab-pane label="User" name="first">User</m-tab-pane>
        <m-tab-pane label="Config" name="second">Config</m-tab-pane>
        <m-tab-pane label="Role" name="third">Role</m-tab-pane>
        <m-tab-pane label="Task" name="fourth">Task</m-tab-pane>
      </m-tabs>
      <m-tabs type="card" class="demo-item">
        <m-tab-pane label="User">User</m-tab-pane>
        <m-tab-pane label="Config">Config</m-tab-pane>
        <m-tab-pane label="Role">Role</m-tab-pane>
        <m-tab-pane label="Task">Task</m-tab-pane>
      </m-tabs>
    </m-row>
    <h4>Dialog</h4>
    <m-row>
      <div role="dialog" aria-modal="true" aria-label="Tips" class="el-dialog" style="margin: 0"><div class="el-dialog__header"><span class="el-dialog__title">Tips</span><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i class="el-dialog__close el-icon el-icon-close"></i></button></div><div class="el-dialog__body"><span>This is a message</span> </div><div class="el-dialog__footer"><span class="dialog-footer"><button type="button" class="el-button el-button--default"><!----><!----><span>Cancel</span></button> <button type="button" class="el-button el-button--primary"><!----><!----><span>Confirm</span></button></span></div></div>
    </m-row>
    <h4>Tooltip</h4>
    <m-row>
      <div role="tooltip" x-placement="top" class="el-tooltip__popper is-dark" style="position: relative; width: 40px;text-align: center;">Dark<div x-arrow="" class="popper__arrow"></div>
      </div>
      <div role="tooltip" x-placement="top" class="el-tooltip__popper is-light" style="margin-top: 10px;position: relative; width: 40px;text-align: center;">Light<div x-arrow="" class="popper__arrow"></div>
      </div>
    </m-row>
    <h4>Popover</h4>
    <m-row>
      <div role="tooltip" x-placement="top" id="el-popover-2936" aria-hidden="true" class="el-popover el-popper el-popover--plain" tabindex="0" style="width: 200px; position: relative; "><div class="el-popover__title">Title</div>this is content, this is content, this is content<div x-arrow="" class="popper__arrow"></div></div>
    </m-row>
    <h4>Card</h4>
    <m-row>
      <m-card class="box-card">
        <div slot="header" class="clearfix">
          <span>Card name</span>
        </div>
      </m-card>
    </m-row>
    <h4>Carousel</h4>
    <m-row>
      <m-carousel height="150px">
        <m-carousel-item v-for="item in 4" :key="item">
          <h3>{{ item }}</h3>
        </m-carousel-item>
      </m-carousel>
    </m-row>
    <h4>Collapse</h4>
    <m-row>
      <m-collapse v-model="collapse">
        <m-collapse-item title="Consistent" name="1">
          <div>Consistent with real life: in line with the process and logic of real life, and comply with languages and habits that the users are used to;</div>
        </m-collapse-item>
        <m-collapse-item title="Feedback" name="2">
          <div>Operation feedback: enable the users to clearly perceive their operations by style updates and interactive effects;</div>
        </m-collapse-item>
      </m-collapse>
    </m-row>
    <h4>Avatar</h4>
    <m-row class="demo-line avatar-demo">
      <m-avatar icon="el-icon-user-solid"/>
      <m-avatar> avatar </m-avatar>
      <m-avatar shape="square" fit="contain" :src="avatarData.url"></m-avatar>
      <m-avatar size="large"> large </m-avatar>
      <m-avatar size="medium"> medium </m-avatar>
      <m-avatar size="small"> small </m-avatar>
    </m-row>
  </div>
</template>
<script>
export default {
  data() {
    return {
      radio: '1',
      radio1: 'Washington',
      radio2: '1',
      checked: true,
      checked1: ['Shanghai'],
      checked2: true,
      input: 'Mandala',
      inputNumber: 1,
      selectOptions: [
        {
          value: 'Option1',
          label: 'Option1'
        },
        {
          value: 'Option2',
          label: 'Option2'
        },
        {
          value: 'Option3',
          label: 'Option3'
        },
        {
          value: 'Option4',
          label: 'Option4'
        },
        {
          value: 'Option5',
          label: 'Option5'
        }
      ],
      selectValue: '',
      cascadeOptions: [
        {
          value: 'guide',
          label: 'Guide',
          children: [
            {
              value: 'disciplines',
              label: 'Disciplines',
              children: [
                {
                  value: 'consistency',
                  label: 'Consistency'
                },
                {
                  value: 'feedback',
                  label: 'Feedback'
                }
              ]
            }
          ]
        },
        {
          value: 'resource',
          label: 'Resource',
          children: [
            {
              value: 'axure',
              label: 'Axure Components'
            },
            {
              value: 'sketch',
              label: 'Sketch Templates'
            },
            {
              value: 'docs',
              label: 'Design Documentation'
            }
          ]
        }
      ],
      cascaderValue: [],
      switchValue: true,
      slider: 28,
      datePicker: '',
      rate: null,
      transferData: (() => {
        const data = [];
        for (let i = 1; i <= 15; i++) {
          data.push({
            key: i,
            label: `Option ${i}`,
            disabled: i % 4 === 0
          });
        }
        return data;
      })(),
      transfer: [1, 4],
      tableData: [
        {
          date: '2016-05-03',
          name: 'Tom',
          address: 'No. 189, Grove St, Los Angeles'
        },
        {
          date: '2016-05-02',
          name: 'Tom',
          address: 'No. 189, Grove St, Los Angeles'
        },
        {
          date: '2016-05-04',
          name: 'Tom',
          address: 'No. 189, Grove St, Los Angeles'
        },
        {
          date: '2016-05-01',
          name: 'Tom',
          address: 'No. 189, Grove St, Los Angeles'
        }
      ],
      menu: '1',
      tab: 'first',
      collapse: ['1'],
      treeData: [{
        label: 'Level one 1',
        children: [{
          label: 'Level two 1-1',
          children: [{
            label: 'Level three 1-1-1'
          }]
        }]
      }, {
        label: 'Level one 2',
        children: [{
          label: 'Level two 2-1',
          children: [{
            label: 'Level three 2-1-1'
          }]
        }, {
          label: 'Level two 2-2',
          children: [{
            label: 'Level three 2-2-1'
          }]
        }]
      }, {
        label: 'Level one 3',
        children: [{
          label: 'Level two 3-1',
          children: [{
            label: 'Level three 3-1-1'
          }]
        }, {
          label: 'Level two 3-2',
          children: [{
            label: 'Level three 3-2-1'
          }]
        }]
      }],
      defaultTreeProps: {
        children: 'children',
        label: 'label'
      },
      avatarData: {
        url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
      }
    };
  }
};
</script>
